package com.yanqu.road.server.cmd.activity.gashapon;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.GashaponProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.gashapon.GashaponModule;
import com.yanqu.road.server.protocol.Protocol;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author : Cxp
 * @Time : 2024-10-23
 * @Description :
 */

@Cmd(code = Protocol.S_GASHAPON_PLAY_ANIMATION, desc = "选择奖励")
public class GashaponPlayAnimationCmd extends AbstractCommand {
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        GashaponProto.GashaponPlayAnimationMsgReq req = GashaponProto.GashaponPlayAnimationMsgReq.parseFrom(packet.getBytes());
        ret = player.getModule(GashaponModule.class).playAnimation(req.getActivityId());
    }

    @Override
    public void sendData(GamePlayer player) {
        if (ret != 0) {
            player.sendPacket(Protocol.U_GASHAPON_PLAY_ANIMATION, GashaponProto.GashaponPlayAnimationMsgResp.newBuilder().setRet(ret));
        }
    }
}
